home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 4
/
MacMania 4.toast
/
/
Demo's
/
Igor Demo Pro
/
1 PutContentsIn Igor Pro Folder
/
WaveMetrics Procedures
/
Analysis
/
Median
< prev
next >
Wrap
Text File
|
1995-12-31
|
533b
|
21 lines
#pragma rtGlobals=1
| Median(w, x1, x2)
| Based on Numerical Recipes in C pp. 476-477.
| Returns median value of wave w from x=x1 to x=x2.
| Pass -INF and +INF for x1 and x2 to get median of the entire wave.
Function Median(w, x1, x2)
Wave w
Variable x1, x2
Variable result
Duplicate/R=(x1, x2) w, tempMedianWave | Make a clone of wave
Sort tempMedianWave, tempMedianWave | Sort clone
SetScale/P x 0,1,tempMedianWave
result = tempMedianWave((numpnts(tempMedianWave)-1)/2)
KillWaves tempMedianWave
return result
End